package com.aididi.configuration;

import com.aididi.interceptor.FeignInterceptor;
import feign.Logger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ：xuzexiang
 * @description：
 * @date ： 2022/2/23 15:07
 */
@Configuration
public class FeignConfiguration {

    @Bean
    Logger.Level feignLoggerLevel() {
        return Logger.Level.FULL;
    }

    @Bean
    Logger feignLoggerConfiguration(){
        return new FeignLoggerConfiguration();
    }

    /**
     * 创建Feign请求拦截器，在发送请求前设置认证的token,各个微服务将token设置到环境变量中来达到通用
     * @return
     */
    @Bean
    public FeignInterceptor basicAuthRequestInterceptor() {
        return new FeignInterceptor();
    }
}
